1. Field of the Disclosure
The present disclosure relates generally to dynamic language application processing, and more particularly, to a method for processing a dynamic language application using multiple dynamic language codes, and an electronic device using the same, in a multiprocessor environment.
2. Description of the Related Art
With recent advances in the processor technology, single-core processors have evolved into multicore processors. In a multicore processor, different tasks may be processed by different cores. Hence, an electronic device, such as, for example, a mobile terminal employing a multicore processor, may improve task processing performance.
An electronic device, or a mobile terminal, may use JAVASCRIPT® to represent a dynamic webpage in a browser.
JAVASCRIPT® is a procedural language having a context, and thus, it may be difficult to apply parallel processing to JAVASCRIPT® code. JAVASCRIPT® is also a dynamic type language, and thus, it is possible to improve execution performance by generating machine code, such as just-in-time (JIT) code. However, technology for improving execution performance of dynamic languages in a multiprocessor environment is underdeveloped. For example, in the case of JAVASCRIPT®, use of a multiprocessor is limited to JAVASCRIPT® code with different contexts.
To execute source code in a dynamic language, the electronic device may compile the source code into a first machine code under the assumption of a first type (e.g., an integer). The electronic device may detect a failure in the code during execution of the first machine code. The failure may be caused by inappropriate type inference or assumptions made during compilation (i.e., the first machine code of the first type is not suitable for execution). In the case of failure, a bailout occurs. When a bailout occurs during execution, the electronic device may compile the source code into second machine code under the assumption of a second type (e.g. float), and may execute the second machine code.
Consequently, when a bailout occurs during execution of dynamic language code, additional time may be needed to generate a new machine code of a different type.
In the case of dynamic language code, a high-quality machine code may increase the execution speed of the code. However, the high-quality machine code may require a longer generation time (compile time).